package com.me.batm.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.me.batm.GameConstants;
import com.me.batm.OurGdxGame;

public class GameOverScreen implements Screen {

	Label titleScreen;
	OurGdxGame ourGdxGame;
	Stage stage;
	long currentTime;
	
	public GameOverScreen(OurGdxGame _ourGdxGame) {
		this.ourGdxGame = _ourGdxGame;
		stage = new Stage();
		Gdx.input.setInputProcessor(stage);	
		currentTime = System.currentTimeMillis();
	}
	
	@Override
	public void render(float delta) {
		// TODO Auto-generated method stub
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
        Table.drawDebug(stage);     
        if(System.currentTimeMillis() - currentTime > 2000) {
        	ourGdxGame.setScreen(new MenuScreen(ourGdxGame));
        }
	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		Skin skin = new Skin(Gdx.files.internal("data/uiskin2.json"));
		titleScreen = new Label("Presents...", skin);	
		
		Table table = new Table();		
		stage.addActor(table);
		float width  = GameConstants.SCREEN_WIDTH / 2.0f ;
		float height = GameConstants.SCREEN_HEIGHT / 2.0f;		
		table.setSize(width, height);
		table.setPosition(GameConstants.DESKTOP_SCREEN_WIDTH/2.0f - width/2.0f,GameConstants.DESKTOP_SCREEN_HEIGHT/2.0f - height/2.0f);
		
		table.add(titleScreen);		
		table.row();
		table.center();
	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}

}
